New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Missing fixes] Tile Culling mechanism #954
Conversation
The culling mechanism sometime crashes when going outside/ on the border of the game plane . Non the less, I please you to test it under other cases and report the bugs if you find it. |
I confirm that there's a big FPS gain when starting the tile culling, especially in big maps. It does crash when reaching the borders of the level, though. Another issue seems to be that the minimap does not really work properly, probably because the tiles it should render are culled. |
Cool to see progress there! I do hope you'll be able to fix the bugs noticed by @akien-mga :) |
Bertram25 : OK , may I set the limits for camera position ? Actually see my Issue >> Eliminating black space << please ... :) @ALL ; Have you noticed this crash happens only for edges at X = 0 or Y =0 leaving the other pair intact ... seems this bug would be quickly found .... |
Ok , I fixed all that , the only problem lurking is the minimap presentation layer . Would you like the old one back ? |
im a fan of the old one... |
I confirm that the crashes at the border are gone. I didn't see the issue in @hwoarangmy's screenshot so far, on the other hand when you move very quickly with the arrows / WASD, you can see some culled tiles in the direction where you're moving. |
I tried to even enlarge the area with myArray.zoom(1.2532); but it helps only a little. I still expect some help with making it automaticly start startTileCulling and stopTIleCulling at the beginning and at the end from the other part of the team . |
55fe711
to
c2411b9
Compare
unculled than it is required, so there are no problems when moving camera quickly. Culling starts automaticlly with a new game
c2411b9
to
6a15716
Compare
@OpenDungeons/developers Tom merged all commits into one as the single commits were not really meaningful taken alone. It's ready for review I believe :) |
Cool! I'll have a look asap. (Busy as hell, but still around ;]) |
#include <sstream> | ||
#include <algorithm> | ||
|
||
using std::set; using std::swap; using std::max; using std::min; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please no using. Those leads to bad practices IMHO.
The code still has a lot of useless spaces and newlines all over the place, could you fix that? Btw, why are you using extern values of Units and precision digits? Couldn't this be avoided by setting a correct value an set it in a proper common header? |
@tomluchowski That's better, indeed. However, you have not removed the now useless headers from the cameramanager and not answered some of my questions in code. Concerning SlopWalk, could you please explain what the values in the arrays are supposed to be ? I couldn't guess from reading the code. Note that when you will have to cull entities on tile, you can easily do it by using Tile::mEntitiesInTile (on client side, creatures and most of the entities are added to mEntitiesInTile even the moving ones). |
How about now ? |
I will review the whole PR tomorrow but I guess it should be good. |
I've tried but there is still the bug with the minimap. However, once it is fixed, it is mergeable for me. @tomluchowski For my information, I've seen you use 4 Ogre rays to know the tiles the player can see (I guess by checking the 4 corners of the screen). Once there, I would have expected a simple linear extrapolation to know all the tiles within vision. Is the algorithm you used better in some way ? I must admit I didn't take enough time to really understand how it works. |
It is much better in many ways , first of it does not check for visibility of every Tile there is on the board, second is it attaches/ detaches Tile only when it has to (when it appeared or disappeard due to previous iteration ) ; naive algorithm would hide all the Tiles from the previous iteration and compute the new set of all visible TIles -- and attach them . |
"I would have expected a simple linear extrapolation to know all the tiles within vision" |
I've tried but there is still the bug with the minimap. However, once it is fixed, it is mergeable for me. |
Yes, that's what I was expecting. Simple. To do better, your algorithm has really to be fast. I should have a deeper look as it is interesting ^^
IMHO, removing a feature because it is broken by another one is not the way to go. If I implement gem tiles and break tile culling in my way, would you think disabling tile culling would be a good solution ? |
@tomluchowski We're a spare-time project, so finishing what we start is a key point if we want to stay relevant as a project. Otherwise, we'll be leaving a trail of unfinished features behind us, which is a known common cause of spare time projects death. The former OD team is plainly concerned by that sadly. But I am, too, somehow. |
Btw, I consider both minimaps broken or sub-optimized, but again, we're a spare-time project. ;) |
Btw, what is left to do here, apart the minimap fix? |
I would say only the minimap fix. Apart from that, the features seems to work well. I think @tomluchowski wants to go for creature culling but IMHO, it would be better to do that in a new PR |
Yes, he should do that in a new PR, the poor one already bleed a lot to get this one, let's not be too cruel. ;) |
"Btw, I consider both minimaps broken or sub-optimized, but again, we're a spare-time project. ;)" sub-optimized ? |
I've not looked deep enough your code to know every subtility but you said that only changed tiles are culled. That would mean that you somehow keep a list of culled tiles. If it is the case, the easiest way would be to unhide tiles before rendering the minimap (I don't know how hard it will hit performances, though). You might also want to somehow cull tiles not rendered in the minimap. |
" That would mean that you somehow keep a list of culled tiles." |
@OpenDungeons/developers So what's the status quo? It looks like we have an interesting new feature that also happens to break the minimap, and @tomluchowski doesn't know how to fix it. Should we merge and have someone else try to fix it, or keep it around until we find a solution? |
For my part, as I've said in the comments, I couldn't easily follow the code by reading it (complex code and not enough comments). In a professional context, that would be enough to reject the PR. But this is a free time project so we don't have to be too strict. However, I'm not convinced by the use of int64_t. By experience, it is likely to hide a bug. Moreover, if @tomluchowski, the author, cannot find the list of impacted tiles from his own code, it doesn't sound very good. |
Overall, I must say I agree with @hwoarangmy 's points which have to be fixed before going further.
Here, I disagree. Please note that this very project (before the fork) was dead because of such PR were allowed, and even without any review. As a spare-time project, I'd rather say it's even more important to agree about merging PRs that are readable only. More than in a professional environment. But please, never undermine quality in spare-time project, you'll pay it even more than when there is someone paid to fix it. |
Ok, I tend to agree with both of you. I haven't reviewed the code myself, but if you say that it hasn't the readability we strive for usually, then it's probably best kept out of the main branch. Since the result is still relatively interesting, what do you think about merging the PR in a specific branch (i.e. not development, but a tile-culling branch that we would create)? |
I would say that the most important thing is that we need to have a code repository as easy to get in as possible to allow newcomers to join.
I just wanted to say that it is a free time project and everybody can propose what he wants (and we cannot ask more than what one wants to do). However, it is our responsability to keep the code as clean and accessible as possible and to reject code we don't find good enough to be merged.
Honestly, I don't see the point. If the code is good enough, it should be merged in the main repository. If not, it should be dropped. If we keep it in a separate branch, it will rot until not mergeable and we will forget about it. |
"If someone wants to take the time to really understand what the code does and fix the minimap, I won't be against merging." The problem with minimap is when I started working on culling feature it was 2D pixel based version, so my hiding or unhidding some tiles didn't broke anything. Both minimaps would cause a problem for me to work properly, the other issue being that you seem to be undecided which version should stay for good. The easiest way for me would be to go for 2d pixel verison and ask on ogre3d forum why our code does not work under DirectX, and what to do to make it working, despite me not having Windows installed... I really put much effort and don't want to get it discarded, I wanted to have position in CV about an open- source game somehow improved by me, however clumsy I am at it tough .... |
I'm closing this one as it cannot be finished for now. I've linked with corresponding issue and will close it for now. |
The game gets tile culling mechanism with this upgrade. Please open console and type 'startTileCulling'